package models

import (
	__ "appointment-srv/basic/proto"
	"gorm.io/gorm"
	"time"
)

type PhysicalExamPackage struct {
	gorm.Model
	PackageName      string    `gorm:"type:varchar(255);comment:'套餐名'"`
	HospitalId       int       `gorm:"type:int;comment:'所属医院id'"`
	Price            float64   `gorm:"decimal(10,2);comment:'价格'"`
	OriginalPrice    float64   `gorm:"decimal(10,2);comment:'原有的价格'"`
	Items            string    `gorm:"type:varchar(10);comment:'套餐包含项目'"`
	ApplicablePeople string    `gorm:"type:varchar(10);comment:'适用人群'"`
	Notes            string    `gorm:"type:varchar(10);comment:'体检注意事项'"`
	ValidityPeriod   time.Time `gorm:"type:datetime;comment:'有效期'"`
	Status           int       `gorm:"type:int;comment:'套餐状态 0 上架 1 下架'"`
}

func (s *PhysicalExamPackage) GetList(db *gorm.DB) (list []*__.PhysicalList, err error) {
	err = db.Model(&PhysicalExamPackage{}).Order("price desc").Find(&list).Error
	return
}
